<%@ Control %>
<%@ Register TagPrefix="CS" Namespace="CommunityServer.Controls" Assembly="CommunityServer.Controls" %>
<%@ Register TagPrefix="FileGalleries" Namespace="CommunityServer.Files.Controls" Assembly="CommunityServer.Files" %>

<script language="javascript">

function getAttachmentData(result)
{
	// result = new Array(TemporaryPostAttachmentGuid, FileName, FriendlyFileName, IsRemote)
	if (result != null)
	{
		document.getElementById('<%= TempAttachmentGuid.ClientID %>').value = result[0];
		document.getElementById('<%= FileName.ClientID %>').innerHTML = result[1];
	
		document.getElementById('<%= UploadFile.ClientID %>').innerHTML = '<FileGalleries:ResourceControl ResourceName="EntryAdmin_FileOrUrl_UpdateUpload" runat="server" />';
	}
}

</script>

<div class="CommonContentArea">
	<h2 class="CommonTitle"><asp:Label runat="server" id="FormTitle" /></h2>
	<div class="CommonContent">

		<asp:Label ID="ErrorLabel" Runat="server" Visible="False" />
		
		<div class="CommonFormArea">
			<h4 class="CommonFormTitle"><FileGalleries:ResourceControl runat="server" ResourceName="EntryAdmin_EntrySettings" ID="Resourcelabel1"/></h4>
			<div class="CommonFormFieldName">
				<FileGalleries:ResourceControl runat="server" ResourceName="EntryAdmin_FileOrUrl" ID="Resourcelabel2"/>
			</div>
			<div class="CommonFormField">
				<asp:Label ID="FileName" Runat="server" />
				<input type="hidden" id="TempAttachmentGuid" runat="server" NAME="TempAttachmentGuid"/>
				<CS:ModalLink ID="UploadFile" Runat="server" CssClass="CommonTextButton" Width="500" Height="300" Callback="getAttachmentData" />
				<span runat="server" id="FileValidation" class="CommonValidationWarning" style="display: none;">*</span>
			</div>
			<div class="CommonFormFieldName">
				<FileGalleries:ResourceControl runat="server" ResourceName="EntryAdmin_Name" ID="Resourcelabel6"/>
				<div class="CommonFormFieldDescription"><FileGalleries:ResourceControl runat="server" ResourceName="EntryAdmin_Name_Detail" ID="Resourcelabel7"/></div>
			</div>
			<div class="CommonFormField">
				<asp:TextBox id="EntryName" Columns="70" MaxLength="256" runat="server" />
				<asp:requiredfieldvalidator id="Requiredfieldvalidator1" runat="server" Cssclass="CommonValidationWarning" ControlToValidate="EntryName">*</asp:requiredfieldvalidator>
			</div>
			<div class="CommonFormFieldName">
				<FileGalleries:ResourceControl runat="server" ResourceName="EntryAdmin_Desc" ID="Resourcelabel8"/>
				<div class="CommonFormFieldDescription"><FileGalleries:ResourceControl runat="server" ResourceName="EntryAdmin_Desc_Detail" ID="Resourcelabel9"/></div>
			</div>
			<div class="CommonFormField">
				<%--<asp:TextBox id="EntryDescription" Columns="70" Rows="5" MaxLenght="3000" TextMode="MultiLine" runat="server" /> --%>
				<CS:Editor runat="Server" id="EntryDescription" width="100%" columns="110" />
			</div>
			<div class="CommonFormFieldName">
				<FileGalleries:ResourceControl runat="server" ResourceName="EntryAdmin_Categories" ID="Resourcelabel4"/>
				<div class="CommonFormFieldDescription"><FileGalleries:ResourceControl runat="server" ResourceName="EntryAdmin_Categories_Detail" ID="Resourcelabel5"/></div>
			</div>
			<div class="CommonFormField">
				<cs:TagEditor runat="server" id="Tags" />
			</div>
			<p />
			<div class="CommonFormField">
				<asp:Button id="EntrySave" runat="server" />
				<asp:Button id="EntryCancel" runat="server" />
			</div>
		</div>
	</div>
</div>

<script language="javascript">

document.getElementById('<%= EntrySave.ClientID %>').onclick = validateFile;

function validateFile()
{
	if (!document.getElementById('<%= TempAttachmentGuid.ClientID %>').value)
	{
		document.getElementById('<%= FileValidation.ClientID %>').style.display = 'inline';
		return false;
	}
	else
	{
		document.getElementById('<%= FileValidation.ClientID %>').style.display = 'none';	
		return true;
	}	
}

</script>




